package com.woniuxy.credit_loans.accounting_shi.service.impl;

import com.woniuxy.credit_loans.accounting_shi.service.DebitInfoService;
import com.woniuxy.credit_loans.accounting_shi.vo.DebitVo;
import com.woniuxy.credit_loans.entity.DebitInfo;
import com.woniuxy.credit_loans.mapper.DebitInfoMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DebitInfoServiceImpl implements DebitInfoService {
    @Resource
    private DebitInfoMapper debitInfoMapper;
    @Override
    public int updateByPrimaryKeySelective(DebitInfo record) {
        return debitInfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<DebitVo> selectAll() {
        return debitInfoMapper.selectAll();
    }

    @Override
    public DebitInfo selectByPrimaryKey(Long id) {
        return debitInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int insertSelective(DebitInfo record) {
         int i = (int) ((Math.random() * 9 + 1) * 100000);
        record.setDiNumber(i);
        record.setDiDebitStatus("待初审");
        debitInfoMapper.insertSelective(record);
        return  0;

    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        debitInfoMapper.deleteByPrimaryKey(id);
        return 0;
    }
}
